package com.lirh.mysql.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lirh.mysql.entity.User1Entity;
import com.lirh.mysql.entity.User2Entity;
import org.apache.ibatis.annotations.*;
import org.omg.PortableInterceptor.INACTIVE;

import java.util.HashMap;

@Mapper
public interface User1Dao extends BaseMapper<User1Entity> {
    @Select("select age from user1 where id=#{id}")
    public String selectname(@Param("id") long id);
    @Select("select @@transaction_isolation;")
    public String selectiso();
    @Select("select * from user1 where ${column}=#{value}")
    public User1Entity findByColumn(@Param("column")String column,@Param("value") String value);
    @Select("select version()")
    public String showversion();
    @Insert("insert into user1 (name,age)values(#{user.name},#{user.age})")
    public void toinsert(@Param("user")User1Entity user);
    @Delete("delete from user1 where id=#{idd}")
    public void todele(@Param("idd")Integer id);
    @Update("update user1 set name=#{name},age=#{age}where id=#{id}")
    public void toupdate(@Param("name")String name,@Param("age")String age,@Param("id")Integer id);
    @Update("update user1 set age=#{user.age}where id=#{user.id}")
    public void toupdate2(@Param("user")User1Entity user);


//    crud
    @Select("select * from user1 where id=#{id}")
    public User1Entity toGet(@Param("id")Integer id);

}
